﻿using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing.Design;
using System.Xml.Serialization;
using Landpy.CruiseControlNet.Infrastructure.Control;

namespace Landpy.CruiseControlNet.FacadeInterface.ConfigurationModule
{
    public class InternalSecurity
    {
        [Editor(typeof(MultipleTypeCollectionEditor), typeof(UITypeEditor))]
        [Category("Basic")]
        [Description("The users of internal sercurity.")]
        [XmlArray("users")]
        [XmlArrayItem("passwordUser", Type = typeof(PasswordUser))]
        [XmlArrayItem("ldapUser", Type = typeof(LdapUser))]
        [XmlArrayItem("userName", Type = typeof(UserName))]
        public List<SecurityUser> Users { get; set; }

        [Editor(typeof(MultipleTypeCollectionEditor), typeof(UITypeEditor))]
        [Category("Basic")]
        [Description("The permissions of internal sercurity.")]
        [XmlArray("permissions")]
        [XmlArrayItem("rolePermission", Type = typeof(RolePermission))]
        [XmlArrayItem("userPermission", Type = typeof(UserPermission))]
        public List<Permission> Permissions { get; set; }

        public InternalSecurity()
        {
            this.Users = new List<SecurityUser>();
            this.Permissions = new List<Permission>();
        }
    }
}